<template>
	<view class="flex-col page">
		<view class="flex-col flex-auto group space-y-47">
			<view class="flex-col group_2">
				<image class="shrink-0 image_6" :src="data.content.cover" />
				<view class="flex-col relative section_3">
					<view class="flex-row items-baseline group_3 space-x-16">
						<view class="group_4">
							<text class="text_5">￥</text>
							<text class="text_4">{{data.content.price}}</text>
						</view>
						<text class="font_2 text_6"
							v-if="data.content.price!=data.content.market_price">￥{{data.content.market_price}}</text>
					</view>
					<text class="self-start text_7">{{data.content.service_name}}</text>
					<view class="flex-col justify-start items-center self-start text-wrapper">
						<text class="font_3 text_8">{{data.content.category}}</text>
					</view>
					<text class="self-start font_3 text_9">销量 {{data.content.sales}}</text>
				</view>
				
				<view class="flex-col list space-y-20">
					<view class="flex-col section_5">
						<text class="self-start font_4">服务明细</text>
						<view class="flex-col" v-for="(item, index) in data.content.intro" :key="index">
							<text class="self-start font_5 text_12">{{item.intro_title}}</text>
							<view class="group_5 font_6" v-html="item.intro_detail"></view>
							<view class="divider" v-if="index!=data.content.intro.length-1"></view>
						</view>
					</view>
				</view>
				<view class="flex-col list space-y-20">
					<view class="flex-col section_5">
						<text class="self-start font_4">服务介绍</text>
						<image :src="data.content.detail" mode="widthFix" ></image>
					</view>
				</view>
				<view class="flex-col list space-y-20">
					<view class="flex-col section_5">
						<text class="self-start font_4">购买须知</text>
						<image :src="data.content.buy_detail" mode="widthFix" ></image>
						<view class="font4" style="margin-top: 20rpx;">{{data.content.content}}</view>
					</view>
				</view>
			</view>
			<view class="flex-col justify-center items-center relative group_7">
				<view class="flex-col justify-center items-center button" @click="toOrder">
					<text class="font_5 text_15">立即修改</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		onLoad,
		onShow,
		onReachBottom,
		onShareAppMessage,
		onShareTimeline
	} from "@dcloudio/uni-app";
	import {
		ref,
		reactive,
		nextTick,
		watch,
		onBeforeUnmount,
		getCurrentInstance
	} from "vue"
	const {
		proxy
	} = getCurrentInstance()
	let interval
	const music = uni.createInnerAudioContext();
	onLoad((option) => {
		console.log(option);
		data.value.service_id = option.service_id
		getDate()
	})
	onShow(() => {

	})
	onBeforeUnmount(() => {

	})
	let data = ref({
		service_id: '',
		content: {
			avatar: '',
			line: 40,
			shoplist: [{
				province_name: "",
				city_name: "",
				district_name: "",
				address: "",
				distance: ""
			}],
			enterprise_info: {},
			alert: [{
				abs_url: ''
			}]
		},
		show:false
	})

	const getDate = () => {
		proxy.$req.requestPOST(proxy.$api.CenterInfo.serviceDetail, {
			service_id: data.value.service_id,
		}).then(res => {
			data.value.content = res.data
			if (res.flag == "success") {

			}
		})
	}

	const onChange = (e) => {
		data.value.currentSwiper = e.detail.current
	}
	const toOrder = () => {
		uni.navigateTo({
			url: '/pages/order/order?service_id=' + data.value.service_id
		})
	}
	const toCoupon = () => {
		uni.navigateTo({
			url: '/pages/coupon/coupon?service_id=' + data.value.service_id
		})
	}
</script>

<style scoped lang="scss">
	.page {
		background-color: #f8f8f8;
		width: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		height: 100%;

		.group {
			overflow-y: auto;
			padding-bottom: 150rpx;

			.group_2 {
				// height: 3001rpx;

				.image_6 {
					width: 750rpx;
					height: 750rpx;
				}

				.section_3 {
					margin-top: -40rpx;
					padding: 50rpx 30rpx 29rpx;
					background-color: #ffffff;
					border-radius: 40rpx 40rpx 0px 0px;

					.group_3 {
						padding: 0 6rpx;

						.group_4 {
							height: 38rpx;

							.text_5 {
								color: #ff3333;
								font-size: 26rpx;
								font-family: PingFangSC;
								line-height: 20rpx;
							}

							.text_4 {
								color: #ff3333;
								font-size: 48rpx;
								font-family: PingFangSC;
								line-height: 38rpx;
							}
						}

						.text_6 {
							color: #999999;
							line-height: 20rpx;
							text-decoration: line-through;
						}
					}

					.space-x-16 {

						&>view:not(:first-child),
						&>text:not(:first-child),
						&>image:not(:first-child) {
							margin-left: 16rpx;
						}
					}

					.text_7 {
						margin-top: 35rpx;
						color: #333333;
						font-size: 34rpx;
						font-family: PingFangHeiTC;
						line-height: 33rpx;
					}

					.text-wrapper {
						margin-top: 17rpx;
						padding: 8rpx 0;
						background-color: #eff5f0;
						border-radius: 6rpx;
						width: 80rpx;

						.text_8 {
							color: #54bc6e;
						}
					}

					.text_9 {
						margin-top: 31rpx;
						color: #a2a2a2;
					}
				}

				.section_4 {
					margin-top: 20rpx;
					padding: 23rpx 30rpx;
					background-color: #ffffff;

					.text_10 {
						color: #333333;
						line-height: 24rpx;
					}

					.text-wrapper_3 {
						margin-left: 14rpx;
						padding: 10rpx 0;
						background-image: url('/static/bg.png');
						background-size: 100% 100%;
						background-repeat: no-repeat;
						height: 42rpx;

						&:nth-child(2) {
							margin-left: 40rpx;
						}

						.text_11 {
							margin-left: 15rpx;
							margin-right: 15rpx;
						}
					}

					.image_7 {
						width: 10rpx;
						height: 18rpx;
					}
				}

				.font_2 {
					font-size: 26rpx;
					font-family: PingFangHeiTC;
				}

				.font_3 {
					font-size: 22rpx;
					font-family: PingFangHeiTC;
					line-height: 21rpx;
					color: #ff3333;
				}

				.list {
					margin-top: 20rpx;
					.font_4 {
						font-size: 33rpx;
						font-family: PingFangSC;
						line-height: 32rpx;
						color: #333333;
					}
					.font4 {
						font-size: 28rpx;
						font-family: PingFangSC;
						line-height: 32rpx;
						color: #333333;
					}
					.section_5 {
						padding: 36rpx 30rpx 33rpx;
						background-color: #ffffff;

						

						.text_12 {
							margin-top: 41rpx;
						}

						.group_5 {
							margin-top: 22rpx;
						}

						.divider {
							margin-top: 29rpx;
							background-color: #ededed;
							border-radius: 0.5rpx;
							height: 2rpx;

						}

						.text_13 {
							margin-top: 38rpx;
						}

						.group_6 {
							margin-top: 22rpx;
						}

						.font_6 {
							font-size: 26rpx;
							font-family: PingFang SC;
							line-height: 40rpx;
							color: #666666;
						}
					}
				}

				.space-y-20 {

					&>view:not(:first-child),
					&>text:not(:first-child),
					&>image:not(:first-child) {
						margin-top: 20rpx;
					}
				}
			}

			.group_7 {
				width: 100%;
				position: fixed;
				bottom: 0;
				height: 130rpx;
				background-color: #fff;

				.button {
					background-color: #54bc6e;
					background-image: linear-gradient(0deg, #00a796 0%, #54bc6e 100%);
					border-radius: 24rpx;
					width: 630rpx;
					height: 98rpx;

					.text_15 {
						color: #ffffff;
						line-height: 28rpx;
					}
				}
			}

			.font_5 {
				font-size: 30rpx;
				font-family: PingFangSC;
				line-height: 29rpx;
				color: #333333;
			}
		}
	}

	.popup {
		width: 510rpx;
		height: 439rpx;
		padding: 0 60rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		text-align: center;
		display: flex;
		align-items: center;
		flex-direction: column;
		justify-content: center;

		&-title {
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
		}

		&-main {
			margin: 50rpx auto;
			display: flex;
			align-items: center;
			flex-direction: column;		

			>span {
				&:nth-child(1) {
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #333333;
					line-height: 44rpx;
				}

				&:nth-child(2) {
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #666666;
					line-height: 44rpx;
					margin-top: 14rpx;
				}

				&:nth-child(3) {
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #FF7022;
					line-height: 44rpx;
				}
			}
		}

		&-btn {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;

			&-left {
				width: 240rpx;
				height: 82rpx;
				border: 2rpx solid rgba(153, 153, 153, 1);
				border-radius: 20rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #999999;
				display: flex;
				align-items: center;
				justify-content: center;
			}

			.active {
				background-color: #54BC6E;
				color: #FFFFFF;
				border: 0;
			}
		}
	}
</style>